package clue

//线索repo

import (
	"context"
	"git.mycaigou.com/gfyx/micro-gfyx-oppty-service/infrastructure/common/utils"
	"git.mycaigou.com/gfyx/micro-gfyx-oppty-service/infrastructure/dto/aggregation"
)

type ClueRepositoryIface interface {
	// ClueQueryList 查询线索列表
	ClueQueryList(ctx context.Context, condition map[string]interface{}, pageInfo *utils.PageInfo) (int64, []*GfyxCluePo, error)
	// ClueUpdate 更新线索
	ClueUpdate(ctx context.Context, condition, updates map[string]interface{}) error
	// ClueDetail 获取线索详情
	ClueDetail(ctx context.Context, clueId int64) (*GfyxCluePo, error)
	// ClueSave 新增线索
	ClueSave(ctx context.Context, po *GfyxCluePo) (*GfyxCluePo, error)
	// ClueCount 获取线索总数
	ClueCount(ctx context.Context, condition map[string]interface{}) (int64, error)
	// ClueUseRank 统计当月添加线索最多的用户
	ClueUseRank(ctx context.Context, beginDate, endDate string, pageInfo *utils.PageInfo) ([]*aggregation.UseRankItem, error)

	// ClueContactSave 新增线索联系人
	ClueContactSave(ctx context.Context, po *GfyxClueContactPo) (*GfyxClueContactPo, error)
	// ClueContactUpdate 更新线索联系人
	ClueContactUpdate(ctx context.Context, condition, updates map[string]interface{}) error
	// ClueContactQueryList 查询线索联系人列表
	ClueContactQueryList(ctx context.Context, condition map[string]interface{}, pageInfo *utils.PageInfo) (int64, []*GfyxClueContactPo, error)

	// ClueTrackerQueryList 查询线索跟进人列表
	ClueTrackerQueryList(ctx context.Context, condition map[string]interface{}, pageInfo *utils.PageInfo, order string) (int64, []*GfyxClueTrackerPo, error)
	// ClueTrackerUpdate 更新线索跟进人
	ClueTrackerUpdate(ctx context.Context, condition, updates map[string]interface{}) error
	// ClueTrackerSave 新增线索跟进人
	ClueTrackerSave(ctx context.Context, po *GfyxClueTrackerPo) (*GfyxClueTrackerPo, error)
	// ClueTrackerFindById 跟进人详情
	ClueTrackerFindById(ctx context.Context, id int64) (*GfyxClueTrackerPo, error)
	// ClueTrackerOutboundInChargeUserIdList 获取ai外呼来源的线索负责人用户id
	ClueTrackerOutboundInChargeUserIdList(ctx context.Context) ([]int64, error)

	// ClueFollowRecordQueryList 查询线索跟进记录列表
	ClueFollowRecordQueryList(ctx context.Context, condition map[string]interface{}, pageInfo *utils.PageInfo) (int64, []*GfyxClueFollowRecordPo, error)
	ClueSaveFollowRecord(ctx context.Context, po *GfyxClueFollowRecordPo) (*GfyxClueFollowRecordPo, error)
	GetCurrentMonthClueCount(ctx context.Context, userId int64, monthStart string, monthEnd string) (int64, error)
}
